<template>
  <div class="dashboard-container">
    <h1>欢迎来到食酷后台管理系统</h1>
    <h2>{{ this.$store.state.user.shop.name }}</h2>
    <h4 style="color: #99a9bf">当前时间：{{ this.time| parseTime }}</h4>
  </div>
</template>

<script>
import {mapGetters} from 'vuex'
import {parseTime} from "@/utils";

export default {
  name: 'index',
  data() {
    return {
      time: new Date()
    }
  },
  filters: {
    parseTime(date) {
      return parseTime(date)
    }
  },
  created() {
    this.timer = setInterval(() => {
      this.time = new Date()
    }, 1000)
  },
  destroyed() {
    clearInterval(this.timer)
  }
}
</script>

<style lang="scss" scoped>
.dashboard {
  &-container {
    margin: 30px;
  }

  &-text {
    font-size: 30px;
    line-height: 46px;
  }
}
</style>
